{set:$item = $this->order_info;}
<div id="pageInfo" data-title="订单详情"></div>
<section class="user_order_detail">

	<table class="detail_table">
		<tr>
			<th>订单编号</th>
			<td>{$item['order_no']}</td>
		</tr>
		<tr>
			<th>下单日期</th>
			<td>{$item['create_time']}</td>
		</tr>

		<tr>
			<th>订单状态</th>
			<td>{echo:Order_Class::orderStatusText($orderStatus)}</td>
		</tr>
		<tr>
			<th>订单操作</th>
			<td>
				{if:in_array($orderStatus,array(1,2))}
				<input class="btn" type="button" value="取消订单" onclick='window.location.href="{url:/ucenter/order_status/order_id/$this->order_info['order_id']/op/cancel}"' />
				{/if}

				{if:$orderStatus == 2}
				<input class="btn" type="button" value="立即付款" onclick="window.location.href='{url:/block/doPay/order_id/$item[id]}'" />
				{/if}

				{if:in_array($orderStatus,array(11,3))}
				<input class="btn" type="button" value="确认收货" onclick='window.location.href="{url:/ucenter/order_status/order_id/$this->order_info['order_id']/op/confirm}"' />
				{/if}

				{if:Order_Class::isRefundmentApply($this->order_info)}
				<input class="btn" type="button" value="申请退款" onclick='window.location.href="{url:/ucenter/refunds_edit/order_id/$this->order_info['order_id']}"' />
				{/if}
			</td>
		</tr>
		<tr>
			<th>订单价格</th>
			<td>
				商品总金额：￥{$item['payable_amount']}
				<span class="red">+</span> 运费：￥
				<label id="freightFee">{$item['real_freight']}</label>
				{if:$item['taxes'] > 0}
				<span class="red">+</span> 税金：￥{$item['taxes']}
				{/if}
				{if:$item['pay_fee'] > 0}
				<span class="red">+</span> 支付手续费：￥{$item['pay_fee']}
				{/if}
				{if:$item['insured'] > 0}
				<span class="red">+</span> 保价：￥{$item['insured']}
				{/if}
				{if:$item['discount'] > 0}
				<span class="red">+</span> 订单涨价：￥{$item['discount']}
				{/if}
				{if:$item['discount'] < 0}
				<span class="red">-</span> 订单折扣：￥{$item['discount']}
				{/if}
				{if:$item['promotions'] > 0}
				<span class="red">-</span> 促销优惠金额：￥{$item['promotions']}
				{/if}
			</td>
		</tr>
		<tr>
			<th>共需支付</th>
			<td>￥{$item['order_amount']}</td>
		</tr>
		<tr>
			<th>收货人</th>
			<td>{$item['accept_name']}</td>
		</tr>
		<tr>
			<th>收货地址</th>
			<td>{$this->order_info['province_str']} {$this->order_info['city_str']} {$this->order_info['area_str']} {$this->order_info['address']}</td>
		</tr>
		<tr>
			<th>邮编：</th>
			<td>{$this->order_info['postcode']}</td>
		</tr>
		<tr>
			<th>固定电话</th>
			<td>{$item['telphone']}</td>
		</tr>
		<tr>
			<th>手机号码</th>
			<td>{$item['mobile']}</td>
		</tr>
		<tr>
			<th>配送方式：</th>
			<td>{$this->order_info['delivery']}</td>
		</tr>
		{if:$this->order_info['takeself']}
		<tr>
			<th>自提地址：</th>
			<td>
				{$this->order_info['takeself']['province_str']}
				{$this->order_info['takeself']['city_str']}
				{$this->order_info['takeself']['area_str']}
				{$this->order_info['takeself']['address']}
			</td>
		</tr>
		<tr>
			<th>自提联系方式：</th>
			<td>
				座机：{$this->order_info['takeself']['phone']} &nbsp;&nbsp;
				手机：{$this->order_info['takeself']['mobile']}
			</td>
		</tr>
		{else:}
		<tr>
			<th>物流公司</th>
			<td>{$item['freight']['freight_name']}</td>
		</tr>
		<tr>
			<th>快递单号</th>
			<td>{$item['freight']['delivery_code']}</td>
		</tr>
		{/if}
		<tr>
			<th>运费</th>
			<td>{$item['real_freight']}</td>
		</tr>
		<tr>
			<th>支付方式</th>
			<td>{$item['payment']}</td>
		</tr>
		{if:$this->order_info['paynote']}
		<tr>
			<th>支付说明</th>
			<td>{$this->order_info['paynote']}</td>
		</tr>
		{/if}

		{if:$item['invoice']==1}
		<tr>
			<th>所需税金</th>
			<td>{$item['taxes']}</td>
		</tr>
		<tr>
			<th>发票抬头</th>
			<td>{$item['invoice_title']}</td>
		</tr>
		{/if}
	</table>

	{set:$order_id=$item['id']} {foreach:items=Api::run('getOrderGoodsListByGoodsid',array('#order_id#',$order_id)) item=$good} {set:$good_info = JSON::decode($good['goods_array'])}
	<table class="detail_table">
		<tr>
			<th>商品</th>
			<td>
				<a href="{url:/site/products/id/$good[goods_id]}">
					<img src="{url:/pic/thumb/img/$good[img]/w/140/h/140}">
				</a>
			</td>
		</tr>
		{if:$good['delivery_id']}
		<tr>
			<th>物流信息</th>
			<td>
				<input type='button' class='btn' value='点击查询' onclick="freightLine({$good['delivery_id']});" />
			</td>
		</tr>
		{/if}
		<tr>
			<th>商品单价</th>
			<td>￥{$good['real_price']}</td>
		</tr>
		<tr>
			<th>商品数量</th>
			<td>x {$good['goods_nums']}</td>
		</tr>
		<tr>
			<th>赠送积分</th>
			<td>{echo:$good['point']*$good['goods_nums']}</td>
		</tr>
		<tr>
			<th>优惠金额</th>
			<td>￥{echo:$good['goods_price']-$good['real_price']}</td>
		</tr>
	</table>
	{/foreach}
	</div>
</section>

<script>
	$(function(){
		hideNav()
	})
	//快递跟踪
	function freightLine(doc_id) {
		var urlVal = "{url:/block/freight/id/@id@}";
		urlVal = urlVal.replace("@id@", doc_id);
		art.dialog.open(urlVal, {
			'title': '轨迹查询',
			'width': '80%',
			'height': '80%'
		});
	}

	//修改表单信息
	function editForm() {
		$('#acceptShow').toggle();
		$('#acceptForm').toggle();
	}
</script>
